package com.youlai.boot.modules.content.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youlai.boot.modules.content.model.entity.LzArticle;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.boot.modules.content.model.query.LzArticleQuery;
import com.youlai.boot.modules.content.model.vo.LzArticleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 文章Mapper接口
 *
 * @author lz0816
 * @since 2025-02-25 16:26
 */
@Mapper
public interface LzArticleMapper extends BaseMapper<LzArticle> {

    /**
     * 获取文章分页数据
     *
     * @param page        分页对象
     * @param queryParams 查询参数
     * @return
     */
    Page<LzArticleVO> getLzArticlePage(Page<LzArticleVO> page, LzArticleQuery queryParams);

    @Update("UPDATE lz_article SET view_count =  #{viewCount} WHERE id = #{articleId}")
    void updateViewCount(@Param("articleId") Long articleId, @Param("viewCount") Long viewCount);
}
